#!/bin/sh
set -o nounset
#set -x #DEBUG

cd $SCRIPT_BINDDIR
. bin/rootfs-library.sh

# Exit if nothing to do
exit_if_stamped $0

# Temporarily install policy file to prevent services from running
prevent_services_running
export DEBIAN_FRONTEND=noninteractive

printinfo Upgrading packages, using proxy: $CONFIG_APT_PROXY
http_proxy=$CONFIG_APT_PROXY apt-get update &&
http_proxy=$CONFIG_APT_PROXY apt-get upgrade -y || die Unable to upgrade packages!

allow_services_to_run
make_stamp $0
printsuccess Completed upgrading packages.

exit 0
